package com.wjx.zk

import org.apache.curator.framework.CuratorFramework
import org.apache.curator.framework.CuratorFrameworkFactory
import org.apache.curator.retry.ExponentialBackoffRetry

fun getInstance(): CuratorFramework {
    val retryPolicy = ExponentialBackoffRetry(1000, 3)
    val zk = CuratorFrameworkFactory.builder()
            .connectString("192.168.11.128:2182,192.168.11.128:2183,192.168.11.128:2184")
            .sessionTimeoutMs(5000)
            .retryPolicy(retryPolicy)
            .namespace("curator")
            .build()
    zk.start()
    println("zk start")
    return zk
}